package com.qpcy.entity;

import com.mybatisflex.annotation.*;

import java.io.Serializable;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 案例 实体类。
 *
 * @author DELL
 * @since 2024-10-27
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "cases")
public class Cases implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 案例id
     */
    @Id(keyType = KeyType.Auto)
    private Integer caseId;

    /**
     * 风格id
     */
    private Integer styleId;

    @RelationOneToOne(selfField = "styleId", targetField = "styleId", targetTable = "style")
    private Style style;

    /**
     * 轮播图，第一张作为案例封面
     */
    private String pictures;

    private Integer sort;

    @RelationManyToMany(
            joinTable = "product_case", // 中间表
            joinSelfColumn = "case_id",
            joinTargetColumn = "product_id"
    )
    private List<Product> products;

}
